package com.xdf.ecommerce.service.impl;

import com.mybatisflex.core.query.QueryWrapper;
import com.xdf.ecommerce.dao.EcommerceUserMapper;
import com.xdf.ecommerce.entity.EcommerceUser;
import com.xdf.ecommerce.service.EcommerceUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chanchaw
 * @create 2025-10-14 22:00
 */
@RequiredArgsConstructor
@Service
public class EcommerceUserServiceImpl implements EcommerceUserService {
    private final EcommerceUserMapper dao;
    @Override
    public List<EcommerceUser> find8Username(String username) {
        EcommerceUser user = new EcommerceUser();
        user.setUsername(username);
        QueryWrapper qw = QueryWrapper.create(user);
        List<EcommerceUser> userList = dao.selectListByQuery(qw);
        return userList;
    }
    @Override
    public EcommerceUser insert(EcommerceUser record){
        int i = dao.insertSelective(record);
        return dao.selectOneById(record.getId());
    }
}
